#include "ros/ros.h"
#include "plumbing_pub_sub/Person.h"

int main(int argc, char *argv[])
{
    /* code */
    setlocale(LC_ALL, "");
    ROS_INFO("这是消息的发布方");
    ros::init(argc, argv, "banzhuren");
    ros::NodeHandle nh;
    ros::Publisher pub = nh.advertise<plumbing_pub_sub::Person>("liaotian", 10);
    plumbing_pub_sub::Person person;
    person.age = 1;
    person.name = "张三";
    person.height = 1.76;

    ros::Rate rate(1);
    ros::Duration(3).sleep();
    while(ros::ok())
    {
        person.age += 1;
        pub.publish(person);
        ROS_INFO("发布的消息：%d,%s,%.2f",person.age,person.name.c_str(),person.height);
        rate.sleep();

        ros::spinOnce();
    }
    return 0;
}
